package com.musictest;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class PlayReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        final ToastModule toastModule = ToastModule.getInstance();
        String action = intent.getAction();

//        System.out.println("BroadcastReceiver");
//        System.out.println(action);
//        System.out.println(toastModule);

        if (action.equals("com.musictest.broadcasttest.NEXT")) {
            toastModule.onNextMusic();
        }else if (action.equals("com.musictest.broadcasttest.PREVIOUS")) {
            toastModule.onPrevMusic();
        } else if (action.equals("com.musictest.broadcasttest.EXIT")) {//通知栏点击退出图标
            System.out.println("停止");
        } else if (action.equals("com.musictest.broadcasttest.PLAYANDPAUSE")) {
            toastModule.onPlayAndPause();
        }
    }

};
